package ACWing.WeeklyRace;
//4920字符串（未解决）用栈模拟较容易实现

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2022/11/19 19:12
 */
public class Stingdemo {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        char[] chars = s.toCharArray();
        ArrayList<String> list=new ArrayList<>();
        int left=0;
        for (int i = 0; i < s.length()-1; i++) {
            if(chars[i]==chars[i+1]){
                chars[i]=0;
                chars[i+1]=0;
                int l=0,r=i+2;
                for (int j = i; j>0; j--) {
                    if(chars[j]!=0){
                        l=j;
                        break;
                    }
                }
               while (l>=1&&r<=s.length()-1){
                   if(chars[l]==chars[r]){
                       chars[l]=0;
                       chars[r]=0;
                   }
                   for (int j = l; j>0; j--) {
                       if(chars[j]!=0){
                           l=j;
                           break;
                       }
                   }
                   r++;
               }


            }
        }
        for (int i = 0; i < s.length(); i++) {
            if(chars[i]!=0){
                System.out.print(chars[i]);
            }
        }
    }
}
